package com.jiamao.goplay.ui.settings;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;

import com.gyf.immersionbar.ImmersionBar;
import com.jiamao.goplay.BR;
import com.jiamao.goplay.R;
import com.jiamao.goplay.app.AppViewModelFactory;
import com.jiamao.goplay.base.BaseMVVMFragment;
import com.jiamao.goplay.databinding.SettingsColorLayoutBinding;
import com.jiamao.goplay.ui.settings.vm.ColorVM;

public class ColorFragment extends BaseMVVMFragment<SettingsColorLayoutBinding, ColorVM> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.settings_color_layout;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }


    @Override
    public ColorVM initViewModel() {
        //使用自定义的ViewModelFactory来创建ViewModel，如果不重写该方法，则默认会调用LoginViewModel(@NonNull Application application)构造方法
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getActivity().getApplication());
        return ViewModelProviders.of(this, factory).get(ColorVM.class);
    }

    @Override
    public void initData() {
        super.initData();
        ImmersionBar.with(this). keyboardEnable(false).statusBarDarkFont(true).titleBar(binding.getRoot().findViewById(R.id.toolbar)).init();

        TextView titleTv =  binding.getRoot().findViewById(R.id.tvTitle);
      titleTv.setText("设置皮肤");
      binding.getRoot().findViewById(R.id.ll_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                    getActivity().finish();
            }
        });
    }
}
